//
//  PKTopicCommentHeadView.m
//  PianKe
//
//  Created by lanou on 15/10/20.
//  Copyright © 2015年 李伟伟. All rights reserved.
//

#import "PKTopicCommentHeadView.h"
#import <UIImageView+WebCache.m>
#import "NSString+Html.h"
@implementation PKTopicCommentHeadView

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _groupTitleLabel = [[UILabel alloc]initWithFrame:CGRectMake(70, 20, 100, 20)];
        _groupTitleLabel.font = [UIFont systemFontOfSize:12];
        
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 60, SCREEN_WITDTH-40, 40)];
        _titleLabel.font = [UIFont systemFontOfSize:18];
        
        _iconView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 105, 40, 40)];
        _iconView.layer.masksToBounds = YES;
        _iconView.layer.cornerRadius = 20;
        _iconView.contentMode = UIViewContentModeScaleAspectFit;
        
        _unameLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 110, 100, 20)];
        
        _addtime_fLabel = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WITDTH-100, 110, 80, 20)];
        
        [self addSubview:_groupTitleLabel];
        [self addSubview:_titleLabel];
        [self addSubview:_iconView];
        [self addSubview:_unameLabel];
        [self addSubview:_addtime_fLabel];
        
        _webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 130, SCREEN_WITDTH, 100)];
        [self addSubview:_webView];
        
        
    }
    return self;
}

-(void)setConfigreModel:(PKTopicDetailModel *)configreModel
{
    _groupTitleLabel.text = configreModel.groupInfo[@"title"];
    _titleLabel.text = configreModel.title;
    [_iconView sd_setImageWithURL:[NSURL URLWithString:configreModel.userinfo.icon]];
    _unameLabel.text = configreModel.userinfo.uname;
    _addtime_fLabel.text = configreModel.addtime_f;
    
    NSString *str = [NSString importStyleWithHtmlString:configreModel.html];
    [_webView loadHTMLString:str baseURL:[NSURL URLWithString:[NSBundle mainBundle].bundlePath]];
    
    
}










@end


























